import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Scanner;

import com.google.java.contract.Requires;


public class Database implements DatabaseInterface {
	private boolean userTableEmpty;
	private boolean coasterTableEmpty;
	private String [] users;
	private String currentUser;
	private Rollercoaster [] rollerCoasters;
	private Rollercoaster currentCoaster;


	@Requires("!userTableEmpty()")
	public void addUser() {
		userTableEmpty = false;
		//add a user to the table user
	}

	@Requires("!coasterTableEmpty()")
	public Rollercoaster[] getAllRollercoasters() {
		return rollerCoasters;
	}

	@Requires("!userTableEmpty()")
	public String[] getAllUsers() {
		return users;
	}
	@Requires("!userTableEmpty()")
	public String getUser() {
		return currentUser;
	}
	public void saveRollerCoaster(Rollercoaster coaster) {
		//add rollerCoaster to the current user

	}

	public void setUser() {//same here

	}
	public boolean userSet() {//same here
		return false;
	}
	public boolean userTableEmpty() {//check if the table is empty(no user)
		return userTableEmpty;
	}

	public boolean connectedToDB() {
		return false;
	}

	public boolean coasterTableEmpty() {
		return coasterTableEmpty;
	}

	public static void main(String [] args) throws ClassNotFoundException, SQLException{

		Class.forName("org.sqlite.JDBC");
		Connection con = DriverManager.getConnection("jdbc:sqlite:coasterDb");
		Statement stat = con.createStatement();

		boolean done = false;
		Scanner input = new Scanner(System.in);
		while (!done) {
			System.out.print("do some': ");
			String cmd = input.nextLine();
			if (cmd.equals("quit")) {
				done = true;
			} else {
				stat.execute(cmd);
			}
		}
	}

	@Override
	public ArrayList<String> getAllCoasterNames() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Rollercoaster getRollercoaster(String name) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void addUser(String name) {
		// TODO Auto-generated method stub
		
	}
}

